//package io.github.novaframe.config;
//
//import io.github.novaframe.web.mapper.JsonMapper;
//import org.springframework.boot.autoconfigure.AutoConfigureAfter;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
//import org.springframework.data.redis.serializer.StringRedisSerializer;
//
///**
// * Redis 配置
// * Created by Locki on 8/27/2017.
// */
//@Configuration
//@AutoConfigureAfter(WebMvcConfiguration.class)
//public class RedisConfiguration {
//
//    @Bean
//    JedisConnectionFactory connectionFactory() {
//        return new JedisConnectionFactory();
//    }
//
//    @Bean
//    Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer(JsonMapper jsonMapper) {
//        Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
//        jackson2JsonRedisSerializer.setObjectMapper(jsonMapper.mapper());
//        return jackson2JsonRedisSerializer;
//    }
//
//    @Bean
//    RedisTemplate<String, Object> objRedisTemplate(JedisConnectionFactory jedisConnectionFactory, Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer) {
//        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
//        redisTemplate.setConnectionFactory(jedisConnectionFactory);
//        redisTemplate.setDefaultSerializer(jackson2JsonRedisSerializer);
//
//        StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
//        redisTemplate.setKeySerializer(stringRedisSerializer);
//        redisTemplate.setHashKeySerializer(stringRedisSerializer);
//        return redisTemplate;
//    }
//
//}
